﻿CREATE PROCEDURE [dbo].[Hogar_PersonalCocina_Insertar]   
 @Nombre VARCHAR (50),
 @Apellido VARCHAR (50)
AS 
BEGIN

/*****************************************************************************************************************************************/
-- Author: Carlos Mendoza
-- Purpose:   crea un nuevo personal de cocina
-- Returns:    PersonalCocina
/*****************************************************************************************************************************************/ 
	
	DECLARE @PersonalCocinaId int

	INSERT INTO [dbo].[PersonalCocina]
				(Nombre,
				Apellido,
				Activo)
	VALUES (@Nombre, @Apellido, 1)

	SET @PersonalCocinaId = IDENT_CURRENT('PersonalCocina')

	SELECT  [PersonalCocinaId],
			[Nombre],
			[Apellido],
			CASE WHEN [Activo] = 1 THEN 1 ELSE 0 END AS [Activo]
	FROM	[dbo].[PersonalCocina] WITH (NOLOCK)
	WHERE [PersonalCocinaId] = @PersonalCocinaId
	
END